package com.promise.jokerdream.response.pc

import com.promise.jokerdream.model.friend.PenguinApprenticeModel
import com.promise.jokerdream.model.friend.PenguinBrotherModel
import com.promise.jokerdream.model.friend.PenguinMarryModel
import com.promise.jokerdream.model.friend.PenguinMasterModel
import com.promise.jokerdream.model.friend.PenguinOwnModel
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

// 企鹅个人信息
@Serializable
data class QueryPenguinInfoPCResponse(
    override val result: Int,
    override val msg: String = "",
    // 师傅信息
    val shifu: PenguinMasterModel = PenguinMasterModel(),
    // 徒弟信息
    val tudi: List<PenguinApprenticeModel> = emptyList(),
    // 侠侣信息
    val marry: PenguinMarryModel = PenguinMarryModel(),
    // 结拜信息
    val brother: PenguinBrotherModel = PenguinBrotherModel(),
    @SerialName("baseinfo")
    val baseInfo: PenguinOwnModel = PenguinOwnModel(),
    // 当前状态
    val status: List<PenguinStatusModel> = emptyList(),
): BasePCResponse {
    override fun getDescription(): String {
        return msg
    }

    // 是否有徒弟
    fun hasTudi(): Boolean {
        if (tudi.isEmpty()) {
            return false
        }

        val obj = tudi.last()
        return obj.masterName.isNotEmpty()
    }
}

@Serializable
data class PenguinStatusModel(
    val name: String = "",
    val desc: String = "",
    // 次数或者时间，次数为x次，时间为1970-01-01 08:00:02
    val times: String = "",
)
